package cj.web.sc.dao;
/*
 *  
 *  
*/
import java.util.List;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;
import net.paoding.rose.jade.annotation.SQLParam;
import cj.web.sc.domain.Member;

/**
 * 
 * @author 
 *
 */
@DAO
public interface MemberDAO{
	
    @SQL("SELECT * FROM Member WHERE id=:1")
    Member queryById(int id);
    
	@SQL("UPDATE Member SET phone=:t.phone,name=:t.name,updateUser=:t.updateUser,updateAt=NOW() WHERE id=:t.id")
    void update(@SQLParam("t") Member sCBuyer);
    
    @SQL("UPDATE Member SET deleteFlag=0 WHERE id=:1")
    void deleteById(String id);

    @SQL("SELECT * FROM Member WHERE deleteFlag=1 #if(:t.phone!=''){ and phone like '%##(:t.phone)%' } order by createAt desc limit :t.start,:t.length")
	List<Member> queryByPhone(@SQLParam("t")Member buyer);

    @SQL("SELECT count(0) FROM Member WHERE deleteFlag=1 #if(:t.phone!=''){ and phone like '%##(:t.phone)%' }")
	int sizeByPhone(@SQLParam("t")Member buyer);
    
    @SQL("UPDATE Member SET openId = null WHERE id=:1")
    void unbundlingByUserId(int id);
}